package leetcode.easy.q2951;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Solution {

    public List<Integer> findPeaks(int[] mountain) {
        List<Integer> result= new ArrayList<>();
        for (int i=1;i<=mountain.length-2;){

           if (mountain[i] > mountain[i - 1] && mountain[i] > mountain[i + 1]) {
                result.add(i);
                i += 2;
            }else i++;
        }

        return result;
    }
}